package com.learn.demo.service.impl;

import com.learn.demo.service.ModifyService;
import com.learn.demo.service.QueryService;
import com.learn.springframework.annotation.Autowired;
import com.learn.springframework.annotation.Service;
import lombok.extern.slf4j.Slf4j;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author MI
 */

@Service
@Slf4j
public class QueryServiceImpl implements QueryService {


    /**
     * 循环依赖复现
     */
    @Autowired
    private ModifyService modifyService;

    @Override
    public String query(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = sdf.format(new Date());
        String json = "{name:\"" + name + "\",time:\"" + time + "\"}";
        log.info("这是在业务方法中打印的:" + json);
        return json;
    }
}
